<template>
  <!--会议介绍-->
  <view class="main_section">
    <!--    会议背景图-->
    <view class="section_1">
      <image class="pic" mode="aspectFill" :src="$util.img(meetingSubjectInfo.img)"></image>
    </view>
    <view class="title_section">
      <view class="title">
        会议介绍
      </view>
    </view>
    <view class="section_2">
      <view class="content" v-html="meetingSubjectInfo.introduction || ''"></view>
    </view>

    <view class="title_section">
      <view class="title">
        会议时间
      </view>
    </view>
    <view class="section_3">
      <view>{{meetingList.time_arr.min_start_time || ''}} ~ {{
          meetingList.time_arr.max_end_time || ''}}</view>
    </view>

    <view class="title_section">
      <view class="title">
        会议地点
      </view>
    </view>
    <view class="section_4">
      <view class="ul">
        <view class="li" v-for="(v,k) in meetingList.list" :key="k">
          <view class="box">
            <text>{{v.start_time}} ~ {{v.end_time}}</text>
          </view>
          <view class="box">
            <text>{{v.address_name}}</text>
          </view>
          <view class="box">
            <text>{{v.address}}</text>
            <view class="btn" v-if="v.lng && v.lat" @click="startNavigation(v.lng,v.lat,v.address)">去导航</view>
          </view>
        </view>

<!--        <view class="li">-->
<!--          <view class="box">-->
<!--            <text>2025-07-11 18:30 ~ 2025-07-11 20:30</text>-->
<!--          </view>-->
<!--          <view class="box">-->
<!--            <text>内蒙古-呼和浩特市-新城区</text>-->
<!--          </view>-->
<!--          <view class="box">-->
<!--            <text>战备路18号香格里拉大酒店2层大会议室</text>-->
<!--            <view class="btn">去导航</view>-->
<!--          </view>-->
<!--        </view>-->
<!--        <view class="li">-->
<!--          <view class="box">-->
<!--            <text>2025-07-11 18:30 ~ 2025-07-11 20:30</text>-->
<!--          </view>-->
<!--          <view class="box">-->
<!--            <text>内蒙古-呼和浩特市-新城区</text>-->
<!--          </view>-->
<!--          <view class="box">-->
<!--            <text>战备路18号香格里拉大酒店2层大会议室</text>-->
<!--            <view class="btn">去导航</view>-->
<!--          </view>-->
<!--        </view>-->
      </view>
    </view>

  </view>
</template>

<script>
import apiRoute from '@/api/apiRoute.js';

export default {
  data() {
    return {

      meetingSubjectId:'',//会议主题id

      //会议主题信息
      meetingSubjectInfo:{
        id:'',
        name:'',
        img:'',
        introduction:'',//介绍
      },
      meetingList:[],
    }
  },
  onLoad(options) {
    if (options.meetingSubjectId) {
      this.meetingSubjectId = options.meetingSubjectId
    }
  },
  onShow() {
    this.init()
  },
  methods: {
    async init() {
      await this.getMeetingSubjectInfo()
      await this.getMeetingList()
    },
    //
    //获取会议主题信息
    async getMeetingSubjectInfo(){
      let params = {
        id: this.meetingSubjectId
      }
      let res = await apiRoute.getMeetingSubjectInfo(params)
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      this.meetingSubjectInfo = res.data
    },
    //获取会议子表信息
    async getMeetingList(){
      let params = {
        meeting_subject_id:this.meetingSubjectInfo.id
      }
      let res = await apiRoute.getMeetingList(params)
      if (res.code != 1) {
        uni.showToast({
          title: res.msg,
          icon: 'none'
        })
        return
      }

      this.meetingList = res.data
      // console.log(123123,this.meetingList)
    },

    //去导航
    startNavigation(lng,lat,name){
      uni.openLocation({
        latitude: parseFloat(lat),
        longitude: parseFloat(lng),
        name: name,
        // address: address,
        success: () => {
          console.log('成功打开地图导航');
          uni.showToast({
            title: '导航已启动',
            icon: 'success'
          });
        },
        fail: (err) => {
          console.error('打开地图导航失败:', err);
          uni.showToast({
            title: '导航失败',
            icon: 'none'
          });
        }
      });
    }

  }
}
</script>

<style lang="less" scoped>
.main_section{
  padding-bottom: 40rpx;
  .section_1{
    padding-top: 20rpx;
    .pic{
      width: 100%;
      height: 350rpx;
    }
  }
  .title_section{
    padding: 20rpx;
    .title{
      font-size: 40rpx;
      color: #2a82e4;
    }
  }
  .section_2{
    padding: 0 20rpx;
  }
  .section_3{
    padding: 0 20rpx;
    font-size: 32rpx;
  }
  .section_4{
    padding: 0 20rpx;
    .ul{
      font-size: 28rpx;
      display: flex;
      flex-direction: column;
      gap: 30rpx;
      .li{
        border-radius: 12rpx;
        padding: 10rpx;
        border: 1px solid #999999;
        display: flex;
        flex-direction: column;
        gap: 10rpx;
        .box{
          display: flex;
          justify-content: space-between;
          text{
            width: 85%;
          }
          .btn{
            color: #2a82e4;
          }
        }
      }
    }
  }

}
</style>
